﻿import QtQuick.Controls 1.4 as Control1
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import QtQuick 2.12
import QtCharts 2.14

Rectangle{   //板件总数
    id:controlRoot

    property color  titleBackColor:"#18A689"
    property int    titleTextSize:18
    property string titleText:itemtext.text
    property color  titleTextColor:"white"

    property color  itemBackColor:"#209fdf"
    property int    itemTextSize:18
    property string itemText:""
    property color  itemTextColor:"white"

    color:itemBackColor
    border.color: titleBackColor
    border.width: 1
    radius: 8
    clip:true

    Rectangle{
        id:title
        width: parent.width
        height:titleTextSize*2
        border.color: titleBackColor
        color:titleBackColor
        radius: controlRoot.radius

        Text {
            text:titleText
            anchors.fill: parent
            horizontalAlignment: Text.AlignHCenter
            verticalAlignment: Text.AlignVCenter
            font.pixelSize: titleTextSize
            color:itemTextColor
            leftPadding: horizontalAlignment==Text.AlignHCenter?0:10
        }

        Rectangle{
            color: titleBackColor
            width: parent.width
            height: 1
            anchors.bottom: parent.bottom
            visible: true
        }
    }

    Text {
        id:itemtext
        width: parent.width
        height: parent.height-title.height
        anchors.bottom: parent.bottom
        horizontalAlignment: Text.AlignHCenter
        verticalAlignment: Text.AlignVCenter
        textFormat: Text.RichText
        font.pixelSize:itemTextSize
        wrapMode:Text.Wrap
        color: "white"
        text: itemText
    }
}
